package c_observer.b_design_pattern;

/**
 * Created by wug on 2016/6/16 0016.
 */
public class ObserverCarMonitor implements Observer {
    @Override
    public void update(Subject subject) {
        if (subject instanceof SubjectCar) {
            SubjectCar subjectCar = (SubjectCar)subject;
            System.out.println("当前车速："+ subjectCar.getSpeed() +"km/h");
            System.out.println("维持该车速：" + subjectCar.getRemainTime() +"s");
            System.out.println("剩余燃油：" + subjectCar.getRemainOil() + "ml");
        }
    }
}
